import java.util.Scanner;

// 【倒置字符串】将一句话的单词进行倒置，标点不倒置。比如 I like beijing.
// 经过函数后变为：beijing. like I
public class Day_2_2倒置字符串 {

//    先整体逆置，再根据空格分开逆置
    public static void reverse(char[] c, int i,int j){
        while(i < j){
            char temp = c[i];
            c[i] = c[j];
            c[j] = temp;
            i++;
            j--;
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char[] c = s.toCharArray();
        reverse(c, 0, c.length - 1);
        int start = 0;
        for(int i = 0; i < c.length; i++){
            if(c[i] == ' '){
                reverse(c, start, i - 1);
                start = i + 1;
            }
        }
        reverse(c,start,c.length - 1);
        String str = new String(c);
        System.out.println(str);
    }
}
